<include file="public@header"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-page-header">
            <div class="layui-card">
                <div class="layui-page-header-content">
                    <div class="layui-card-body">
                        <div class="layui-ui-page-header-title" >
                            URL美化<span class="layui-badge-rim page-content">站内网址URL美化编辑</span>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-brief">
                        <ul class="layui-tab-title">
                            <li class="layui-this"><a href="{:url('route/index')}">所有地址</a></li>
                            <li><a href="javascript:admin.openIframeLayer('{:url('route/add')}','添加URL规则',{btn: ['保存','关闭'],area:['640px','50%'],end:function(){location.reload();}});">添加URL规则</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-page-content">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form js-ajax-form" action="{:url('route/listOrder')}" method="post">
                        <div class="layui-btn-container">
                            <button type="submit" class="layui-btn layui-btn-sm  js-ajax-submit">排序</button>
                        </div>
                        <table class="layui-table" lay-even lay-size="lg">
                            <thead>
                            <tr>
                                <th width="50">ID</th>
                                <th width="50">排序</th>
                                <th>原始网址</th>
                                <th>显示网址</th>
                                <th>类型</th>
                                <th>状态</th>
                                <th width="176">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <php>
                                $statuses=array('0'=>"已禁用","1"=>"已启用");
                                $types=array('1'=>"自定义","2"=>"别名定义");
                            </php>
                            <foreach name="routes" item="vo">
                                <tr>
                                    <td>{$vo.id}</td>
                                    <td>
                                        <eq name="vo.type" value="2">
                                            <input class="input-order" type="text" value="{$vo.list_order}" readonly style="width: 50px">
                                            <else/>
                                            <input name="list_orders[{$vo.id}]" class="input-order" type="text" value="{$vo.list_order}" style="width: 50px">
                                        </eq>
                                    </td>
                                    <td>{$vo.full_url}</td>
                                    <td>{$vo.url}</td>
                                    <td>
                                        <eq name="vo.type" value="2">
                                            <span class="layui-badge layui-bg-warning" data-toggle="tooltip" title="别名定义规则,无法编辑,排序">{$types[$vo['type']]}</span>
                                            <else/>
                                            <span class="layui-badge layui-bg-correct" data-toggle="tooltip" title="自定义规则,可以编辑,排序">{$types[$vo['type']]}</span>
                                        </eq>
                                    </td>
                                    <td>
                                        <empty name="vo.status">
                                            <span class="layui-badge-dot layui-bg-abnormal" style="margin-right: 6px;"></span>{$statuses[$vo['status']]}
                                            <else/>
                                            <span class="layui-badge-dot layui-bg-function" style="margin-right: 6px;"></span>{$statuses[$vo['status']]}
                                        </empty>
                                    </td>
                                    <td>
                                        <eq name="vo.type" value="2">
                                            <span class="layui-bo layui-bo-small layui-bo-primary layui-btn-disabled">禁用</span>
                                            <div class="new-divider new-divider-vertical"></div>
                                            <span class="layui-bo layui-bo-small layui-bo-primary layui-btn-disabled">编辑</span>
                                            <div class="new-divider new-divider-vertical"></div>
                                            <span class="layui-bo layui-bo-small layui-bo-primary layui-btn-disabled">删除</span>
                                            <else/>
                                            <eq name="vo.status" value="1">
                                                <a class="layui-bo layui-bo-small layui-bo-waring js-ajax-dialog-btn"
                                                   href="{:url('route/ban',array('id'=>$vo['id']))}"
                                                   data-msg="确定禁用吗？">禁用</a>
                                                <else/>
                                                <a class="layui-bo layui-bo-small layui-bo-succes js-ajax-dialog-btn"
                                                   href="{:url('route/open',array('id'=>$vo['id']))}"
                                                   data-msg="确定启用吗？">启用</a>
                                            </eq>
                                            <div class="new-divider new-divider-vertical"></div>
                                            <a class="layui-bo layui-bo-small layui-bo-checked" href="javascript:admin.openIframeLayer('{:url('route/edit',array('id'=>$vo['id']))}','编辑',{btn: ['保存','关闭'],area:['640px','50%'],end:function(){location.reload();}});">编辑</a>
                                            <div class="new-divider new-divider-vertical"></div>
                                            <a class="layui-bo layui-bo-small layui-bo-close js-ajax-delete"
                                               href="{:url('route/delete',array('id'=>$vo['id']))}">删除</a>
                                        </eq>
                                    </td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="public@script"/>
</body>
</html>